import React, { FC, useMemo } from 'react';
import { Select, DataSet } from 'choerodon-ui/pro';
import { FieldType } from 'choerodon-ui/pro/lib/data-set/enum';

export interface SelectMultipleProps {}

const SelectMultiple: FC<SelectMultipleProps> = () => {
  const ds = useMemo(
    () =>
      new DataSet({
        autoQuery: false,
        fields: [
          {
            name: 'type',
            type: FieldType.string,
            label: '类型选择',
            textField: 'label',
            valueField: 'value',
            multiple: true,
            options: new DataSet({
              autoQuery: true,
              queryUrl: '/api/query/types',
            }),
          },
        ],
      }),
    []
  );
  return <Select dataSet={ds} name="type" onChange={e => console.log(e)} />;
};

export default SelectMultiple;
